#include"Protocol.hpp"
#include"TcpServer.hpp"
#include<memory>
using namespace std;
void Usage(string proc)
{
    cerr<<"Usage"<<proc<<"port"<<endl;
}

int main(int argc,char* argv[])
{
    if(argc!=2)
    {
        Usage(argv[0]);
        exit(USAGE_ERR);
    }
    unique_ptr<Protocal>protocal=make_unique<Protocal>();
    unique_ptr<TcpServer>tsvr=make_unique<TcpServer>(stoi(argv[1]),
        [&protocal](shared_ptr<Socket>&sock,InetAddr&client){
            protocal->GerRequest(sock,client);
    });
    tsvr->Start();
    return 0;
}